using System;
using System.Text.Json.Serialization;

namespace JT808Protocol.Models.Attributes
{
    /// <summary>
    /// Json序列化布尔值自定义属性值Attribute,默认值为`是`或`否`
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class JsonBooleanStringAttribute : JsonAttribute
    {
        public string TrueValue { get; set; }

        public string FalseValue { get; set; }

        /// <summary>
        /// 构造函数，传入布尔为真和假的字符串
        /// </summary>
        /// <param name="trueValue">为真的字符串</param>
        /// <param name="falseValue">为假的字符串</param>
        public JsonBooleanStringAttribute(string trueValue = "是", string falseValue = "否")
        {
            this.TrueValue = trueValue;
            this.FalseValue = falseValue;
        }
    }
}